Hitherto, as devices containing a memory, tape media, floppy disks, hard disks, optical discs, semiconductor media, and so on, are utilized. Among these devices, semiconductor media are receiving attention since built-in memories can be securely managed. The reason for this is that, in a semiconductor memory, it is easy to implement a tamper-resistant structure, and more specifically, a structure in which access is not easily made from an external source.
The tamper-resistant structure can be implemented, for example, as follows. A device is formed by a single semiconductor chip, and a control unit, a memory controller, a non-volatile memory, voltage detection means, frequency detection means, etc., are provided for the semiconductor chip. Then, the non-volatile memory is sandwiched by dummy layers, such as alumina layers, so that it cannot be easily read or written from or into an external source.
A known memory structure of such a secure device is described below with reference to the “known memory structure” shown in FIG. 96. The memory shown in FIG. 96 has a configuration which can be used as, for example, e-money. As shown in FIG. 96, the memory area is largely divided into three areas, i.e., a data area, a memory management area, and a system area.
In the data area, data based on the “data structure” stored in the head of each item of data is stored. In this example, data items, such as the user name, the user address, the user telephone number, the billing, the memo, and the log, are stored. In the memory management area, the storage address, the access method, the access authentication key, and so on, for accessing each data item in the data area are stored. For example, access can be made to data 1 (user name) in the data area by read only (Read) with the access authentication key (0123 . . . ). In the system area, a device identifier (ID), and a memory management key, which is an authentication key for reserving the memory area in the data area, etc., are stored.
The data area of the memory device shown in FIG. 96 can be divided into a plurality of areas, and such divided areas can be managed by different service entities, for example, if e-money services are provided, by different e-money service providing entities (ex. different banks). Data in each divided area is read and written (ex. updating of balance data) not only by the individual service providing entities, but also by users, for example, by a reader/writer (dedicated reader/writer or a PC), which serves as a device access machine installed in a store that conducts sales using e-money.
The relationship between the manager and the user of a secure device having a plurality of divided data areas, such as that shown in FIG. 96, is indicated by the “memory manager/user” in FIG. 97. FIG. 97 illustrates a memory manager, which is the entity for issuing the secure device, and data users, to which the memory areas are assigned from the memory manager, and which utilize the assigned memory areas. As the memory users, a data 1 user through a data 6 user are shown. The memory users are banks or stores if e-money services are provided as in the above-described example.
The memory manager has an access-control memory management key for reserving memory areas, and assigns the memory areas (divided data areas) to the memory users by using the memory management key. The memory user has an access authentication key for accessing data in each data area, and is able to access the memory in the assigned data area by using the access authentication key. There are various access modes, such as read, write, and decrement, and the access authentication keys are individually set according to the processing mode, so that a determination can be individually made as to whether the processing is to be allowed.
Data 4 in the memory shown in FIG. 96, for example, is billing data, and the data 4 user is able to perform, as shown in FIG. 97, decrement processing and read/write processing on data 4. As shown in the table at the bottom right side of FIG. 96, different access keys are assigned to the decrement processing and the read/write processing for data 4, and it is necessary to access data 4 by using the appropriate access key for each processing.
FIG. 98 illustrates memory reserving processing performed by the memory manager for assigning the data areas in a memory device to the memory users. As shown in the “memory reserving system” shown in FIG. 98, the memory manager executes the data-area reserving processing for the memory device indicated at the right side of FIG. 98 by using a memory-reserving reader/writer (R/W: Reader/Writer) indicated at the left side of FIG. 98. The memory-reserving reader/writer (R/W: Reader/Writer) is provided with a secure NVRAM (Non-Volatile RAM) for reserving a memory management key. The memory-reserving R/W may be a secure-device-dedicated reader/writer R/W, or if the secure device is a device provided with an I/F, such as a USB or PCMCIA, the memory-reserving R/W may be a unit which can read and write via such an interface, for example, a PC.
For reserving a memory by using the R/W, a device ID is first read from the secure device. Then, in the R/W, an authentication key is created by using the memory management key and the device ID, and performs mutual authentication with the secure device by using the created authentication key. The mutual authentication processing may be performed by, for example, a common key cryptosystem (ex. ISO/IEC9798-2).
After successfully performing the mutual authentication, the R/W encrypts the data structure, the data size, the access method, and the access authentication key by using a session key, adds a data-checking MAC (Message Authentication Code) value if necessary, and sends the command to the secure device. Upon receiving the command, the secure device decrypts the received data and checks the integrity of the data according to the MAC checking processing if necessary. The secure device then reserves a memory area in the data area of the memory according to the data size indicated in the received data, writes the data structure into the reserved area, and writes the memory address, the access method, and the access authentication key into the memory management area.
In this manner, a plurality of divided data areas are set in the memory device. A description is now given of a memory access method for accessing the memory device provided with a plurality of divided data areas according to the “memory access method” shown in FIG. 99. The reader/writer shown at the left side of FIG. 99 is a memory-access reader/writer (R/W) possessed by the memory user, which is formed of a dedicated R/W or a PC, as in the above-described memory-reserving R/W. The memory-access reader/writer is provided with a secure NVRAM for holding access authentication keys. For accessing a data area of the secure device by using the R/W, the device ID is first read from the secure device. Then, in the R/W, an authentication key is created by using the access authentication key and the device ID, and performs mutual authentication with the secure device by using the created authentication key. After successfully performing the mutual authentication, the R/W makes a predetermined access to the data in the data area corresponding to the access authentication key.
In this case, the access method is defined in the memory management area. Accordingly, if, for example, the access authentication for decrementing the data in data 4 (billing data) has succeeded, the data in data 4 can be decremented, but it cannot be incremented or overwritten as desired, as indicated in the “memory access method” in FIG. 99. In this manner, by setting different access authentication keys used for authentication processing according to the access modes, the security of the individual data items can be enhanced. For example, even if a decrementing R/W is stolen and the data in the NVRAM in the stolen decrementing R/W is decrypted, the possibility of illegally performing incrementing processing of data 4 (billing data) in the secure device in FIG. 99 is small.
Generally, the security of money depositing terminals can be improved, as in ATMs. However, money withdrawing terminals are often used as money collecting machines in stores when goods are delivered, and are installed in different places. They are thus highly vulnerable to theft, and it is difficult to improve the security of the money withdrawing terminals. Thus, it is effective in setting different authentication keys according to the type of data access.
According to the usage mode for the above-described known memory device provided with a plurality of divided data areas, the reserving processing for the data area of the memory is performed by executing the authentication processing using the memory management key, and the access processing in each data area is performed by executing the authentication processing using the-access authentication key. More specifically, however, a common key using, for example, DES encryption algorithms, is used for the above-described processings, and authentication using a public key cryptosystem or verification using a public key cryptosystem is not considered in the above-described configuration.
In the configuration in which a common key is used for a memory management key and an access authentication key, as described above, authentication and access permission can be advantageously performed by the single processing. However, if a leakage of the authentication key occurs, memory access can be made by using the leaked authentication key. Such a configuration is thus problematic in terms of the security.
In order to decrease the cost of the reader/writer (R/W) for accessing the memory device, a configuration in which encryption algorithms are not loaded in the reader/writer (R/W) can be considered. In such a configuration, however, it is impossible to perform authentication processing with the device and encryption processing for encrypting communication data. Thus, such a configuration is not appropriate for a reader/writer which communicates with a device storing user billing data and other private information.